# -*- coding: utf-8 -*-

input = open("Hilfe:Sprachcodes.htm",'r')

output = open("sprachcodes.txt",'w')

langfound = 0

for line in input:
  if langfound == 0:
    if "<td><a href=\"/wiki/" in line :
      lang = line[line.find("title=\"")+7:line.find("\">")]
      langfound = 1
      continue
  if langfound == 1:
    langshort = line[line.find("<td>")+4:line.find("</td>")]
    print (lang + "\t" + langshort)
    output.write(lang + ";" + langshort + "\n")
    langfound = 0